Skip to content

Updates to WfP configuration docs#29418

Open
dinasaur404 wants to merge 1 commit intoproductionfrom
dynamic-bindings
Open

Updates to WfP configuration docs#29418
dinasaur404 wants to merge 1 commit intoproductionfrom
dynamic-bindings

Conversation

@dinasaur404
Copy link
Copy Markdown
Contributor

Minor updates to Workers for Platforms configuration section.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/cloudflare-for-platforms/workers-for-platforms/ @irvinebroque, @dinasaur404, @cloudflare/deploy-config, @cloudflare/pcx-technical-writing

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Preview URL: https://d932b65c.preview.developers.cloudflare.com
Preview Branch URL: https://dynamic-bindings.preview.developers.cloudflare.com

Files with changes (up to 15)

Original Link Updated Link
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/limits/ https://dynamic-bindings.preview.developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/limits/
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/get-started/ https://dynamic-bindings.preview.developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/get-started/
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/migrate/ https://dynamic-bindings.preview.developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/migrate/
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/ https://dynamic-bindings.preview.developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/supported-bindings/ https://dynamic-bindings.preview.developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/binding-groups/supported-bindings/

@dinasaur404 dinasaur404 force-pushed the dynamic-bindings branch 2 times, most recently from dfb72f2 to f668a5b Compare March 27, 2026 20:11
Copy link
Copy Markdown
Member

@a-robinson a-robinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's plenty still to figure out, but it feels very much like the right direction, the right goal to aim for.

```toml
name = "my-platform"

[[kv_namespaces]]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's differentiating these configs as binding groups rather than just individual bindings? These look like the config for binding to just a single KV namespace / AI search namespace / R2 bucket.


1. Your customer writes a normal Worker that calls `env.KV.put("key", "value")`.
2. On the platform side, you pass in the binding group scoped to the customer ID.
3. When the customer's Worker calls `env.KV.put()` for the first time, the runtime sees "this is a write to binding group `CUSTOMER_KV`, scoped to `acme-corp`" — and if a KV store for `acme-corp` does not exist yet, it creates one.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How important is it that this gets created when the binding is first used vs when env.CUSTOMER_KV.get(customerId) is called in the dispatching worker?

Is it bad if the dispatching worker's call is what actually triggers creation of the resource?

1. Your customer writes a normal Worker that calls `env.KV.put("key", "value")`.
2. On the platform side, you pass in the binding group scoped to the customer ID.
3. When the customer's Worker calls `env.KV.put()` for the first time, the runtime sees "this is a write to binding group `CUSTOMER_KV`, scoped to `acme-corp`" — and if a KV store for `acme-corp` does not exist yet, it creates one.
4. Each resource is created as a real, first-class resource with its own ID and data.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything special about how these resources will show up in the control plane APIs for each of the different resource types? e.g. will they be given special names, or tags, or some other field or organization that makes their binding group clear when you, for example, list KV namespaces?


| Binding | What gets created | Creation trigger |
| ----------------------------------------------------------- | ----------------- | ---------------------------------------------------------------- |
| [KV](/kv/) | KV namespace | First write |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason these lists are so specific about what provisions a resource?

Like, is it really intended that doing a get() would n't cause a KV namespace / R2 bucket / AI search index to be created?

| [Queues](/queues/) | Queue | First `send()` |
| [Analytics Engine](/analytics/analytics-engine/) | Dataset | First write |
| [Rate Limiting](/workers/runtime-apis/bindings/rate-limit/) | Rate limiter | First `.limit()` call |
| [Workflows](/workflows/) | Workflow instance | First `.create()` call |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflows require a script to be defined in order to create an instance, and presumably different tenants will want their own scripts, won't they? Maybe the best option is to have the dispatcher create() the Workflow binding with a script for the tenant, something like env.WORKFLOW.create(customerId, {script: customerScript}).

IDK. Either way, this can probably better be sorted out elsewhere.


Limits fall into two categories:

**Operation limits** count actions over the billing cycle. They reset at the start of each monthly billing period.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I shouldn't be making writing nits on docs that will surely be updated before publishing, but it'd be better to call out that these are examples, since as is I read it as the full list of each (which obviously isn't true).

// DB, SEARCH, STORAGE still come from deploy-time config.
const userWorker = env.DISPATCHER.get(customerId, {
bindings: {
KV: env.CUSTOMER_KV.get(customerId),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like during these migration cases, many customers would much rather get back an error than have a new resource automatically created for them when calling env.NS.get() if the resource doesn't already exist.

Because if they get back an error they can fall back to using the existing deploy-time binding. But if they deploy this kind of code before the namespace has been adopted/migrated, then they'll pass in an empty namespace to their tenant, to whom it will look like data was lost. And if that tenant then writes data into the new namespace, we'll have a split-brain scenario on our hands that will have to be manually resolved (by somehow merging the data from the real namespace and the automatically created empty namespace).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants